<html>
<head>
<title>AutoCAD DWG</title>
</head>

<body bgcolor="#ffffff">

<h1>AutoCAD DWG</h1>

OGR supports reading most versions of AutoCAD DWG when built with the Open
Design Alliance Teiga library.  DWG is an binary working format
used for AutoCAD drawings.  A reasonable effort has been made to make the
OGR DWG driver work similarly to the OGR DXF driver which shares a common
data model.  The entire contents of the .dwg file is
represented as a single layer named "entities". <p>

DWG files are considered to have no georeferencing information through OGR.
Features will all have the following generic attributes:

<ul>
<li> Layer: The name of the DXF layer.  The default layer is "0".
<li> SubClasses: Where available, a list of classes to which an element belongs.
<li> ExtendedEntity: Where available, extended entity attributes all appended to form a single text attribute.
<li> Linetype: Where available, the line type used for this entity.
<li> EntityHandle: The hexadecimal entity handle.  A sort of feature id.
<li> Text: The text of labels.
</ul>

A reasonable attempt is made to preserve line color, line width, text size
and orientation via OGR feature styling information when translating elements.
Currently no effort is made to preserve fill styles or complex line style
attributes.<p>

The approximation of arcs, ellipses, circles and rounded polylines as
linestrings is done by splitting the arcs into subarcs of no more than a
threshhold angle.  This angle is the OGR_ARC_STEPSIZE.  This defaults to
four degrees, but may be overridden by setting the configuration variable
OGR_ARC_STEPSIZE.<p>

<h2>DWG_INLINE_BLOCKS</h2>

The default behavior is for block references to be expanded with the
geometry of the block they reference.  However, if the DWG_INLINE_BLOCKS
configuration option is set to the value FALSE, then the behavior is different
as described here.

<ul>
<li> A new layer will be available called blocks.  It will contain one or
more features for each block defined in the file.  In addition to the usual
attributes, they will also have a BlockName attribute indicate what block
they are part of.
<li> The entities layer will have new attributes BlockName, BlockScale,
and BlockAngle.
<li> block referencesd will populate these new fields with the corresponding
information (they are null for all other entities).
<li> block references will not have block geometry inlined - instead they will
have a point geometry for the insertion point.
</ul>

The intention is that with DWG_INLINE_BLOCKS disabled, the block references
will remain as references and the original block definitions will be
available via the blocks layer.<p>

<h2>Building</h2>

Currently DWG building is somewhat adhoc.  On linux the normal practice is
to hand edit gdal/ogr/ogrsf_frmts/dwg/GNUmakefile, update paths, and then
build the driver as a plugin using the "make plugin" target.<p>

</body>
</html>
